package kr.saeildamil.androidstudty.ch09;

import kr.saeildamil.androidstudty.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenu extends Activity {
	boolean mBeginer = true;
	private static final String TAG="LogTest";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch09_changemenu);
		
		Log.v(TAG, "onCreate");
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		Log.v(TAG, "onCreateOptionsMenu");
		MenuInflater inflater=getMenuInflater();
		if (mBeginer){
			Log.v(TAG, "mBeginner " + mBeginer + "초보자 모드");
			inflater.inflate(R.menu.beginner, menu);
		}else{
			Log.v(TAG, "mBeginner " + mBeginer + "전문가모드");
			inflater.inflate(R.menu.professional, menu);
		}
		return true;
	}
	
	public void mOnClick(View v){
		Log.v(TAG, "mOnClick");
		if (v.getId()==R.id.ch09_changemenu_begineer_btn){
			this.mBeginer = true;
			invalidateOptionsMenu();
		}else{
			this.mBeginer = false;
			invalidateOptionsMenu();
		}
	}
}
